/*************************************************************************
 *************************************************************************
 	 	 	 	 	 	 	M2SMA : Basic2DGraphicAgent.h
 *************************************************************************
 *
 	 Copyright (C) 2011
 	 TODO, Steven Costiou, France
 *
 **************************************************************************
 **************************************************************************
 *
	The Basic2DGraphicAgent is simply designed to draw itself as a square
	onto an environment, and to move randomly in a straight line.
 *
 **************************************************************************
 **************************************************************************
 *
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/
 *
 **************************************************************************
 **************************************************************************/

#ifndef BASIC2DGRAPHICAGENT_H_
#define BASIC2DGRAPHICAGENT_H_

#include "SDL/SDL.h"
#include "Agent.h"
#include "CORE_TYPES_AND_DEFINITIONS.h"

class gameEngine;

class Basic2DGraphicAgent : public Agent
{
	public:

		Basic2DGraphicAgent(Engine* anEngine);
		~Basic2DGraphicAgent();
		Basic2DGraphicAgent(const Basic2DGraphicAgent& aBasic2DGraphicAgent, Engine* anEngine); /// FIXME Paramètre enEngine à récupérer via le getParentEngine()

		SDL_Rect* getCoordinates() { return coordinates; };
		unsigned int getDirection() { return direction; };

		unsigned long int getGraphicRegistrationId() { return graphicRegistrationId; };
		void setGraphicRegistrationId(unsigned long int anId) { graphicRegistrationId = anId; };

		virtual void live();

	protected:

		virtual void selfCopyFrom(const Basic2DGraphicAgent& anAgent, Engine* anEngine);
		virtual void display();
		virtual bool isEqualTo(const Basic2DGraphicAgent& anAgent) const;

		void selectRandomDirection();
		void generateRandomcoordinates();
		bool agentIsOutOfBounds();
		virtual void move();

	private:

		SDL_Rect* coordinates;
		unsigned int direction;

		/**
		 * Limits of the environment on which the agent can display itself.
		 */
		unsigned int xBound;
		unsigned int yBound;

		unsigned long int graphicRegistrationId;
};

#endif /* BASIC2DGRAPHICAGENT_H_ */
